package com.cskaoyan.service;

import com.cskaoyan.dao.OrderDao;
import com.cskaoyan.dao.UserDao;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.stereotype.Service;

/**
 * @author stone
 * @date 2022/08/29 11:47
 */
@Service
public class UserServiceImpl implements UserService{
    OrderDao orderDao;

    UserDao userDao1;

    UserDao userDao2;

    // 设置属性值的方法
    // 该方法的形参默认按照类型从容器中取出组件
    @Autowired
    public void setOrderDao(OrderDao orderDao) {
        this.orderDao = orderDao;
    }

    // 如果该类型的组件在容器中不止一个，@Qualifier的value属性指定组件id
    @Autowired
    public void setUserDao1(@Qualifier("userDaoImpl1") UserDao userDao1) {
        this.userDao1 = userDao1;
    }

    @Autowired
    public void setUserDao2(@Qualifier("userDaoImpl2") UserDao userDao2) {
        this.userDao2 = userDao2;
    }
}
